#!/bin/bash
# F. Dang

if [ $# -eq 0 ] ; then 
echo "Usage : $0 run"
exit 1
fi

DIR=./
EXEC=$1

INPUT_FILE="input_4k-4k.txt"
OUTPUT_FILE="script/data_par4msp.dat"

#Number of procs
PROCS=12

#Number of executions
SAMPLES=10

echo "Script launches $SAMPLES executions of"
CMD="./run $PROCS $INPUT_FILE"
echo $CMD
echo $CMD >> $OUTPUT_FILE

for ((I = 1; I <= $SAMPLES ; I = I + 1))
do 
	LOG_OUTPUT=$( ${DIR}$EXEC $PROCS $INPUT_FILE)
	# NF-20 NF-10 
	KADANE=$( echo ${LOG_OUTPUT} | awk '{ print $(NF-1)}')
	#DC=$( echo ${LOG_OUTPUT} | awk '{ print $(NF-10)}')
	#BAE=$( echo ${LOG_OUTPUT} | awk '{ print $(NF-1)}')

	echo "$KADANE	$DC	$BAE" >> $OUTPUT_FILE
done

